"""
魔术方法: __方法名__()
__init__()

__lt__小于符号比较方法

__eq__

"""


class Student:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    # __str__魔术方法
    def __str__(self):
        return f"student类对象，name：{self.name}, age：{self.age}"

    def __lt__(self, other):
        return self.age < other.age

    def __eq__(self, other):
        return self.age == other.age


stu = Student("周杰伦", 20)
print(stu)  # 打印的是内存地址：<__main__.Student object at 0x000001EFE5838E80>
print(stu.__str__())  # student类对象，name：周杰伦, age：20

stu_other = Student("蔺俊杰", 18)

print(stu.__lt__(stu_other))  # False

print(stu.__eq__(stu_other))  # False
